# -*- coding: utf-8 -*-

###########################################################################
## Python code generated with wxFormBuilder (version Jun 17 2015)
## http://www.wxformbuilder.org/
##
## PLEASE DO "NOT" EDIT THIS FILE!
###########################################################################

import wx
import wx.xrc
from collections import OrderedDict
import sys
###########################################################################
## Class ChannelsFrame
###########################################################################

channels = dict()

class ChannelsDialog ( wx.Dialog ):

    def __init__( self, *args, **kw ):
        super(ChannelsDialog, self).__init__(*args, **kw)
        # wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"", pos = wx.DefaultPosition, size = wx.Size(  ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

        self.SetSize((440,207))
        self.SetTitle("Choose Channels")
        
        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
        self.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) )
        self.SetBackgroundColour( wx.Colour( 227, 227, 227 ) )

        test_gbSizer = wx.GridBagSizer( 0, 0 )
        test_gbSizer.SetFlexibleDirection( wx.BOTH )
        test_gbSizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

        self.channels_panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 440,140 ), wx.TAB_TRAVERSAL )
        self.channels_panel.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNTEXT ) )
        self.channels_panel.SetBackgroundColour( wx.Colour( 5, 209, 169 ) )

        gbSizer4 = wx.GridBagSizer( 0, 0 )
        gbSizer4.SetFlexibleDirection( wx.BOTH )
        gbSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

        self.ch1_checkbox = wx.CheckBox( self.channels_panel, wx.ID_ANY, u"CH1", wx.DefaultPosition, wx.Size( 100,50 ), 0 )
        self.ch1_checkbox.SetValue(True)
        self.ch1_checkbox.SetFont( wx.Font( 30, 70, 90, 90, False, wx.EmptyString ) )
        self.ch1_checkbox.SetBackgroundColour( wx.Colour( 5, 209, 169 ) )

        gbSizer4.Add( self.ch1_checkbox, wx.GBPosition( 0, 0 ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )

        self.ch2_checkbox = wx.CheckBox( self.channels_panel, wx.ID_ANY, u"CH2", wx.DefaultPosition, wx.Size( 100,50 ), 0 )
        self.ch2_checkbox.SetFont( wx.Font( 30, 70, 90, 90, False, wx.EmptyString ) )
        self.ch2_checkbox.SetBackgroundColour( wx.Colour( 5, 209, 169 ) )

        gbSizer4.Add( self.ch2_checkbox, wx.GBPosition( 0, 1 ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )

        self.ch3_checkbox = wx.CheckBox( self.channels_panel, wx.ID_ANY, u"CH3", wx.DefaultPosition, wx.Size( 100,50 ), 0 )
        self.ch3_checkbox.SetFont( wx.Font( 30, 70, 90, 90, False, wx.EmptyString ) )
        self.ch3_checkbox.SetBackgroundColour( wx.Colour( 5, 209, 169 ) )

        gbSizer4.Add( self.ch3_checkbox, wx.GBPosition( 0, 2 ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )

        self.ch4_checkbox = wx.CheckBox( self.channels_panel, wx.ID_ANY, u"CH4", wx.DefaultPosition, wx.Size( 100,50 ), 0 )
        self.ch4_checkbox.SetFont( wx.Font( 30, 70, 90, 90, False, wx.EmptyString ) )
        self.ch4_checkbox.SetBackgroundColour( wx.Colour( 5, 209, 169 ) )

        gbSizer4.Add( self.ch4_checkbox, wx.GBPosition( 0, 3 ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )

        self.Confirm_button = wx.Button( self.channels_panel, wx.ID_ANY, u"Confirm", wx.DefaultPosition, wx.Size( 200,70 ), wx.BU_EXACTFIT )
        self.Confirm_button.SetFont( wx.Font( 35, 70, 90, 92, False, wx.EmptyString ) )
        self.Confirm_button.SetBackgroundColour( wx.Colour( 98, 98, 255 ) )

        gbSizer4.Add( self.Confirm_button, wx.GBPosition( 1, 1 ), wx.GBSpan( 1, 4 ), wx.ALL, 5 )


        self.channels_panel.SetSizer( gbSizer4 )
        self.channels_panel.Layout()
        test_gbSizer.Add( self.channels_panel, wx.GBPosition( 1, 0 ), wx.GBSpan( 1, 1 ), wx.EXPAND |wx.ALL, 5 )


        self.SetSizer( test_gbSizer )
        self.Layout()

        self.Centre( wx.BOTH )

        # Connect Events
        self.Confirm_button.Bind( wx.EVT_BUTTON, self.OnConfirm )

    def __del__( self ):
        pass


    # Virtual event handlers, overide them in your derived class
    def OnConfirm( self, event ):
        channels = OrderedDict([
            ('channels', [ch.LabelText for ch in [self.ch1_checkbox,
                                                  self.ch2_checkbox,
                                                  self.ch3_checkbox,
                                                  self.ch4_checkbox
                                                  ] if ch.GetValue() ])])
        print(channels, "in ChooseChannels")
        # self.Close(True)
        self.Destroy()
        # sys.exit()
        # event.Destroy()
        # app.Destroy()
        

if __name__ == "__main__":
    channels_app = wx.App()
    channels_frame = ChannelsFrame(None)
    
    channels_frame.Show()
    channels_app.MainLoop()
